# 
# for_miscelaneous.rb
# 
# Created on 21/09/2007, 17:32:29
# 
module AutoRest      
module RestInstanceMethods
  module Miscelaneous
    
    # Shortcut for accessing class data.
    def ardata
      self.class.ardata
    end
  
    # Url for a resource 
    def ar_resource_url resource= @resource
      meth= "#{ardata.resource_method(@parent_resource, '')}_url"
      
      if @parent_resource
        send meth, @parent_resource, resource
      else
        send meth, resource
      end
    end

    # Url for resources
    def ar_resources_url
      meth= "#{ardata.resources_method(@parent_resource, '')}_url"
      
      if @parent_resource
        send meth, @parent_resource
      else
        send meth
      end
    end
    
  end #module Miscelaneous

end #module RestClassMethods
end #module AutoRest      
    